Ext.onReady(function(){
	//定义一个数据
	var userData = {
		total : 200,
		user:{
			userId:'1',
			name:'JonSnow',
			orders:[
				{id:'001',name:'pen'},
				{id:'002',name:'book'}
			]
		}
	};
	
	//model
	Ext.regModel('user',{
		fields : ['userId', 'name'],
		hasMany:{model:'order',name:'orders'}
	});
	
	Ext.regModel('order',{
		fields:[
			'id','name'
		],
		belongsTo:'user'
	});
	
	var mproxy = Ext.create('Ext.data.proxy.Memory',{
	
		model:'user',
		data:userData,
		reader:{
			type:'json',
			root:'user'
		}
	});
	
	mproxy.read(new Ext.data.Operation(),function(result){
		var datas = result.resultSet.records;
		Ext.Array.each(datas,function(model){
			alert(model.get('name'));
		});
		
		var user = result.resultSet.records[0];
		var orders = user.orders();
		orders.each(function(order){
			alert(order.get('name'));
		});
	});
});